<?php

namespace App\Models\OpenShop\InvestmentPromotion;

use App\Models\BaseModel;
use App\Service\OpenShop\Feishu\ConfigService;
use App\Service\OpenShop\Feishu\MainProcessService;
use App\Support\ChangeSupport;

class OpenShopUserExperienceModel extends BaseModel
{
    protected $table = 'open_shop_user_work_experience';


    protected $fillable = [
        "orderNo",
        "orderNoRubbish",
        "cateringExperience",
        "joinChainExperience",
        "employmentExperience",
        "workLife",
        "createdAt",
        "createdByUid",
        "updatedAt",
        "updatedByUid"
    ];

    public static function getOrderLogTranslate(): array
    {
        return [
            "cateringExperience"   => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "enum" => collect(ConfigService::config("openShop")["workLife"])
                    ->pluck("name", "id")->toArray(),
                "desc" => "是否有餐饮经验"
            ],
            "joinChainExperience"  => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "enum" => collect(ConfigService::config("openShop")["hasExperience"])
                    ->pluck("name", "id")->toArray(),
                "desc" => "是否有加盟连锁经验"
            ],
            "employmentExperience" => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "enum" => collect(ConfigService::config("openShop")["hasExperience"])
                    ->pluck("name", "id")->toArray(),
                "desc" => "是否有自营经验"
            ],
            "workLife"             => [
                "type" => ChangeSupport::FILED_TYPE_ENUM,
                "enum" => collect(ConfigService::config("openShop")["workLife"])->pluck("name", "id")
                                                                                            ->toArray(),
                "desc" => "工作年限"
            ],
        ];
    }

    public static function getDataByOrderNo(string $orderNo)
    {
        return self::query()->where('orderNo', $orderNo)->first();
    }
}
